package com.aaa.dang.modules.review.controller;

import com.aaa.dang.common.entity.BedInfo;
import com.aaa.dang.common.util.BaseContrllor;
import com.aaa.dang.common.util.ResultModel;
import com.aaa.dang.modules.review.service.IReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author: ymk
 * @Date: 2018/12/15 20:57
 * @description:
 */
@RestController
@CrossOrigin
@RequestMapping("/review")
public class ReviewController extends BaseContrllor {
    @Autowired
    private IReviewService ser;

    /**
     * 入住审核查询所有
     * @param query
     * @return
     */
    @RequestMapping("/getAll")
    public ResultModel getliveAll(@RequestParam Map<String,Object> query){

        return ser.getliveAll(query);

    }

    /**
     * 入住审核通过
     * @param query
     * @return
     */
    @RequestMapping("/passlive")
    public ResultModel pass(@RequestParam Map<String,Object> query){

        return ser.passlive(query);
    }

    /**
     * 审核驳回
     * @param query
     * @return
     */
    @RequestMapping("/reject")
    public ResultModel rejectlive(@RequestParam Map<String,Object> query){
        String msg= (String) query.get("msg");
        if(msg=="rejectlive"||"rejectlive".equals(msg)){
            return ser.rejectlive(query);
        }else if(msg=="rejectretire"||"rejectretire".equals(msg)){
            return ser.rejectretire(query);
        }else if(msg=="rejectrent"||"rejectrent".equals(msg)){
           return ser.rejectrent(query);
        }else{
            return ser.rejectposit(query);
        }

    }

    /**
     * 查询退宿审核
     * @param query
     * @return
     */

    @RequestMapping("/getretireAll")
    public ResultModel getretireAll(@RequestParam Map<String,Object> query){
        return ser.getretireAll(query);

    }

    /**
     * 离宿申请通过
     * @param query
     * @return
     */
    @RequestMapping("/passretire")
    public ResultModel passretire(@RequestParam Map<String,Object> query){
        return  ser.passretire(query);
    }


    /**
     * 查询租金审核
     * @param query
     * @return
     */
    @RequestMapping("/getrentAll")
    public ResultModel getrentAll(@RequestParam Map<String,Object> query){

        return ser.getrentAll(query);

    }

    /**
     * 租金审核通过
     * @param query
     * @return
     */
    @RequestMapping("/passrent")
    public ResultModel passrent(@RequestParam Map<String,Object> query){
        return ser.passrent(query);

    }

    /**
     * 获取押金审核
     * @param query
     * @return
     */
    @RequestMapping("/getpositAll")
    public ResultModel getpositAll(@RequestParam Map<String,Object> query){
        return ser.getpositAll(query);
    }

    /**
     * 押金审核通过
     * @param query
     * @return
     */

    @RequestMapping("/passposit")
    public ResultModel passposit(@RequestParam Map<String,Object> query){
        return ser.passposit(query);
    }

    /**
     * 获取床位信息
     * @return
     */
    @RequestMapping("/getbedInfo")
    public List<BedInfo> getbedInfo(int user_sex){
        return ser.getbedInfo(user_sex);
    }

}

